<template>

  <!--
    作者：luoyiming
    时间：2020-06-04
    描述：插件中心-积分商城-商品设置-编辑商品-其它
  -->
  <div>
    <div class="common-form">其他</div>
    <el-form-item label="限購數量" prop="limitNum" :rules="[{  required: true,  message: '請填寫限購數量'}]">
      <el-input type="number" v-model="form.limitNum" class="max-w460"></el-input>
    </el-form-item>
    <el-form-item label="開團人數" prop="assembleNum"
      :rules="[{  required: true,  message: '開團人數最少為2',  validator: assembleLimitnum}]">
      <el-input type="number" v-model="form.assembleNum" class="max-w460"></el-input>
    </el-form-item>
  </div>
</template>

<script>
export default {
  inject: ['form'],
  data() {
    return {};
  },
  methods: {
    assembleLimitnum(rule, value, callback) {
      if (value === '') {
        callback(new Error("請輸入開團人數"));
      } else if (value <= 1) {
        callback(new Error("開團人數最少為1"));
      } else {
        callback();
      }
    }
  }
};
</script>

